<?php

namespace app\admin\controller;

use \think\Controller;
use app\blog\model\MessageModel;

class Message extends Controller
{
    public function lst()
    {
        return view();
    }

    public function message_lst()
    {
        $input = $this->request->get();
        $pageSize = $input['limit'] ?: 10;
        $page = $input['page'] ?: 1;
        $messageModel = new MessageModel();
        $data = $messageModel->order('id','desc')
            ->paginate($pageSize,'',['page'=>$page])->toArray();
        $res = array(
            'code' => 0,
            'msg' => '',
            'count' => $data['total'],
            'data' => $data['data'],
        );
        return json($res);
    }
}